$(function(){
    // Cancel icon is clicked
    $('.link-cancel').click(function(e){
        e.preventDefault();

        var reason = prompt('Please enter your cancelation reason','');
        if(reason==null || reason==''){
            return;
        }

        $('#frmAct #id').val($(this).parent().parent().attr('bid'));
        $('#frmAct #act').val('cancel');
        $('#frmAct #reason').val(reason);
        
        document.frmAct.submit();
    });
    
    // Approve icon is clicked
    $('.link-approve').click(function(e){
        e.preventDefault();

        $('#frmAct #id').val($(this).parent().parent().attr('bid'));
        $('#frmAct #act').val('approve');

        document.frmAct.submit();
    });

    // Data is clicked
    $('.data').click(function(){
        var bid = $(this).parent().attr('bid')
        var baseurl = $('#view-content').attr('baseurl');
        var page = $('#view-content').attr('page');

        $('#frmAct').attr('action',baseurl+'/backend/booking/details/bid/'+bid);
        $('#frmAct #prev').val(page);
        document.frmAct.submit();
    });
});
